﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns
{
    public interface IStrage
    {
        List<int> Sort(List<int> list);
    }

    class SortAsc : IStrage
    {
        List<int> IStrage.Sort(List<int> list)
        {
            list.Sort();
            return list;
        }
    }

    class SortDesc : IStrage
    {
        List<int> IStrage.Sort(List<int> list)
        {
            list.Sort();
            list.Reverse();
            return list;
        }
    }

    class StragePatternContext
    {
        private readonly IStrage _strage;

        public StragePatternContext(IStrage strage)
        {
            _strage = strage;
        }


        public void DoSometing()
        {
            var list = new List<int> { 2, 3, 1, 4, 5 };

            _strage.Sort(list).ForEach(c => Console.Write(c + ","));
            Console.WriteLine();
        }
    }
}
